class ApplicationAccountSetting < ActiveRecord::Base
  # default bundle for show in site
  # style css
  
  validates_presence_of :application_account_id, :name, :description
  validates_uniqueness_of :name, :scope => [:application_account_id], :message => "must be unique"
  
  #----- Act as FINITE STATE MACHINE -------------
  acts_as_state_machine :initial => :active, :column => :status

  state :inactive, :column => :status
  state :active, :column => :status

  event :activate do
     transitions :from => :inactive, :to => :active
  end

  event :deactivate do
    transitions :from => :active, :to => :inactive
  end
  
  # reference of statuses for this model
  def self.statuses
    [RefActionStatus::ACTIVE, RefActionStatus::INACTIVE]
  end
  
  # reference of pre_settings
  def self.presettings
    %w(style mail_configuration)
  end
  #-----------------------------------------------
end
